<#assign dialogId = id + "logo"/>
<div class="restaurant-logo">
    <div>
        <img src="<@ofbizUrl>ViewSimpleContent?contentId=${logoContentId?default("DEFAULT_LOGO")}</@ofbizUrl>" id="logo-${dialogId}"/>
    </div>
    <#if hasPermission>
    <a href="javascript: void(0);" id="upload-logo-button-${dialogId}" class="upload-logo" title="${uiLabelMap.RestaurantChangeLogo}">
        <i class="fa fa-camera"></i>
    </a>
    </#if>
    <a class="menus-button" href="/restaurant/control/Menus">${uiLabelMap.RestaurantMenus}</a>
</div>
<#if hasPermission>
<script>
    function updateLogo${dialogId} (iframe) {
        contentId${dialogId} = $(iframe).contents().find("span").html();
        if (contentId${dialogId}) {
            $("#logo-${dialogId}").attr("src", "<@ofbizUrl>ViewSimpleContent</@ofbizUrl>?contentId=" + contentId${dialogId});
            ajaxButtonNoRefreshAlert("<@ofbizUrl>setRestaurantLogo</@ofbizUrl>", "webSiteId=${context.webSiteId?if_exists}&contentId=" + contentId${dialogId}, false);
        }
    }
</script>
<#-- Edit Menu Start-->
<div style="display: none">
    <form name="uploadLogoForm${dialogId}" action="<@ofbizUrl>uploadImage</@ofbizUrl>" method="post" target="edit-logo-iframe-${dialogId}" enctype="multipart/form-data">
        <input type="file" name="uploadedFile" id="upload-logo-file-${dialogId}" value="" class=""/>
    </form>
    <iframe name="edit-logo-iframe-${dialogId}" id="edit-logo-iframe-${dialogId}" onLoad="updateLogo${dialogId}(this)"></iframe>
</div>
<script type="text/javascript">
    $("#upload-logo-button-${dialogId}").click(function () {
        $("#upload-logo-file-${dialogId}").trigger("click");
    });
    $("#upload-logo-file-${dialogId}").change(function () {
        document.uploadLogoForm${dialogId}.submit();
    });
</script>
<#-- Edit Menu End-->
</#if>
